package pp.infrastructure.mysql.mapper.video;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface VideoMapper extends BaseMapper<VideosDo> {

    /**
     * 保存文件基本信息
     * @param videosDo
     * @return
     */
    @Insert("INSERT INTO pp_file_videos (user_id, file_name, file_path, file_size, file_type, upload_time) " +
            "VALUES (#{userId}, #{fileName}, #{filePath}, #{fileSize}, #{fileType}, #{uploadTime})")
    public boolean addVideo(VideosDo videosDo);


    /**
     * 获取文件在磁盘上的路径
     * @param id
     * @return
     */
    @Select("SELECT file_path FROM pp_file_videos WHERE id = #{id}")
    public String getVideoById(Long id);
}
